<?php

namespace Biz\service\advertisement\db;

use Biz\model\advertisement\MPositionBaseInfo;

class TaskCounterCache extends Cache
{
    const TASK_TYPE_POSITION_CACHE = 1;
    const TASK_MAP = [
        self::TASK_TYPE_POSITION_CACHE => [

        ],
    ];
    public function getData($id)
    {
        return 99;
    }

    public static function readTask()
    {

        $redis = self::getInstance()->getOtherRedis();
        $key = $redis->getFullKey();
        dump($redis->keys("$key*"));
//        $redis->hset($key, "type:id", 7);
//        $redis->hset($key, "task:1:2", 1);
//        $redis->hset($key, "task:1:3", 4);
//        $redis->hset($key, "task:1:4", 5);
        dump($redis->hlen($key));
        dump($redis->hget($key, $taskName = 'task:1:2'));
        dump($redis->hgetall($key));
        dump($redis->type($key)->getPayload());
//        dump($key);
//        $key = $redis->getFullKey("1_2_3");
//        dump($key);
//        dump($redis->info());
//        $redis->del('B:CACHE:AD_POSITION:123');
    }

    public static function run(callable $callback,  ...$args)
    {
        return call_user_func_array($callback, $args);
    }


}
